package com.xuelang.pipeline.artifact.app.nexus3v1.request;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Collections;
import java.util.List;

/**
 * @author xiwen.zxg
 * @since 2024/7/16
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CreateWebhookRepositoryRequest {


    private String action = "capability_Capability";
    private String method = "create";
    private String type = "rpc";
    private int tid = 234;
    private List<CapabilityData> data = Collections.singletonList(new CapabilityData());

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class CapabilityData {

        private String id = "NX.coreui.model.Capability-5";
        private String typeId = "webhook.repository";
        private String notes = "";
        private boolean enabled = true;
        private PropertiesData properties = new PropertiesData();
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class PropertiesData {

        private String repository;
        private String names = "asset,component";
        private String url;
        private String secret;
    }
}
